import asyncio
import time
# 创建一个用于测试的协程任务的函数
async def test_task(a, b):
    result = a + b
    await asyncio.sleep(result)
    return "执行耗时任务：{}秒！".format(result)

start_time = time.time()
loop = asyncio.get_event_loop()
asyncio.set_event_loop(loop)
task1 = loop.create_task(test_task(0, 1))
task2 = loop.create_task(test_task(0, 2))
task3 = loop.create_task(test_task(0, 3))
# 创建多个协程任务的列表
tasks = [task1, task2, task3]
loop.run_until_complete(asyncio.wait(tasks))
for task in tasks:
    print(task.result())

end_time = time.time()
print("程序实际执行时间为：", end_time - start_time,"秒！")